﻿<div class="panel panel-default">
    <div class="panel-heading">
        <h2 ng-if="!vm.isEditMode">{{::vm.translate.get('Create Warehouse')}}</h2>
        <h2 ng-if="vm.isEditMode">{{::vm.translate.get('Edit Warehouse')}}</h2>
    </div>
    <div class="panel-body">
        <form name="warehouseForm" class="form-horizontal">
            <div class="col-sm-offset-2 bg-danger" ng-show="vm.validationErrors">
                <ul>
                    <li ng-repeat="error in vm.validationErrors track by $index">{{error}}</li>
                </ul>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">{{::vm.translate.get('Name')}}</label>
                <div class="col-sm-10">
                    <input name="name" ng-model="vm.warehouse.name" class="form-control" required />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">{{::vm.translate.get('Contact Name')}}</label>
                <div class="col-sm-10">
                    <input name="code" ng-model="vm.warehouse.contactName" class="form-control" />
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">{{::vm.translate.get('Phone')}}</label>
                <div class="col-sm-10">
                    <input name="type" ng-model="vm.warehouse.phone" class="form-control" />
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">{{::vm.translate.get('Address Line 1')}}</label>
                <div class="col-sm-10">
                    <input name="type" ng-model="vm.warehouse.addressLine1" class="form-control" />
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">{{::vm.translate.get('Address Line 2')}}</label>
                <div class="col-sm-10">
                    <input name="type" ng-model="vm.warehouse.addressLine2" class="form-control" />
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">{{::vm.translate.get('City')}}</label>
                <div class="col-sm-10">
                    <input name="type" ng-model="vm.warehouse.city" class="form-control" />
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">{{::vm.translate.get('Country')}}</label>
                <div class="col-sm-10">
                    <select required class="form-control" ng-model="vm.warehouse.countryId" ng-change="vm.onCountrySelected(vm.warehouse.countryId)" ng-options="country.id as country.name for country in vm.countries"></select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">{{::vm.translate.get('State Or Province')}}</label>
                <div class="col-sm-10">
                    <select required class="form-control" ng-model="vm.warehouse.stateOrProvinceId" ng-change="vm.onStateOrProvinceSelected(vm.warehouse.stateOrProvinceId)" ng-options="stateOrProvince.id as stateOrProvince.name for stateOrProvince in vm.statesOrProvinces"></select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">{{::vm.translate.get('District')}}</label>
                <div class="col-sm-10">
                    <select class="form-control" ng-model="vm.warehouse.districtId" ng-options="district.id as district.name for district in vm.districts">
                        <option value="0">None</option>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">{{::vm.translate.get('Postal Code')}}</label>
                <div class="col-sm-10">
                    <input name="type" ng-model="vm.warehouse.zipCode" class="form-control" />
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button class="btn btn-primary" ng-click="vm.save()"><span class="glyphicon glyphicon-ok"></span> {{::vm.translate.get('Save')}}</button>
                    <button ui-sref="warehouses" class="btn btn-default">{{::vm.translate.get('Cancel')}}</button>
                </div>
            </div>
        </form>
    </div>
</div>